home *** CD-ROM | disk | FTP | other *** search
- Path: gambier.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: HELP NEEDED..Please no Sermons
- Date: 15 Mar 1996 10:07:54 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4icblqINN79k@gambier.ugrad.cs.ubc.ca>
- References: <4i7th3$c9@newsbf02.news.aol.com> <4i9elsINN7ss@keats.ugrad.cs.ubc.ca>
- NNTP-Posting-Host: gambier.ugrad.cs.ubc.ca
-
- In article <4i9elsINN7ss@keats.ugrad.cs.ubc.ca>,
- Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> goofed:
- >#include <time.h>
- >#include <stdio.h>
- >.
- >.
- >.
- > char str[20];
- >
- > strftime(str,20,"%H.%M.%S",localtime(NULL));
- >
- > puts(str);
-
- localtime() can't deal with a NULL argument properly, unlike time(). So the
- above should be:
-
- char str[20];
- time_t t = time(NULL);
-
- /* ... or a statement (void) time(&t); */
-
- strftime(str, 20, "%H.%M.%S", localtime(&t));
-
- Thanks to Gordin burditt <gordon@sneaky.lerctr.org> for pointing out the
- problem.
- --
-
-